package com.yuanfeng.authserver.service;

import com.yuanfeng.commoms.util.ResponseResult;
import com.yuanfeng.commoms.vo.user.UserInfoVO;
import io.seata.core.exception.TransactionException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Map;

public interface LoginServcie {

    ResponseResult login(UserInfoVO user) throws IOException;

    ResponseResult logout(UserInfoVO user);

    ResponseResult codelogin(Map<String, String> paraMap);

    ResponseResult sendVerificationCode(Map<String, String> paraMap);

    ResponseResult getVerify();

    ResponseResult getVerify2();

    ResponseResult getShopVerify();

    ResponseResult getSupplierVerify();

    /**
     * 生成手机验证码2
     *
     * @param map
     * @return
     * @throws IOException
     */
    ResponseResult verifiPhoneCode2(Map<String, Object> map);

    /**
     * app 授权登录
     * @param paraMap
     * @return
     */
    Map<String, Object> uniappLogin(Map<String, String> paraMap);

    /**
     * app 微信授权注册
     * @param paraMap
     * @return
     */
    ResponseResult uniappRegister(Map<String, String> paraMap) throws IOException, TransactionException;

    /**
     * 微信小程序 授权登录
     * @param paraMap
     * @param request
     * @param response
     * @return
     */
    Map<String, Object> code2Session(Map<String, String> paraMap, HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException;

    /**
     * 微信小程序 授权注册
     * @param paraMap
     * @return
     */
    ResponseResult weixinCodelogin(Map<String, String> paraMap) throws IOException, TransactionException;

    /**
     * 获取微信小程序code
     * @param paraMap
     * @return
     * @throws IOException
     */
    ResponseResult code2SessionopenId(Map<String, String> paraMap) throws IOException;

    /**
     * 微信小程序是否允许自动登录
     * @param paraMap
     * @return
     */
    Map<String, Object> queryAutoLogin(Map<String, String> paraMap) throws UnsupportedEncodingException;

    /**
     * 小程序支付前 授权
     * @param paraMap
     * @return
     */
    Map<String, Object> paymentAuthorization(Map<String, String> paraMap) throws UnsupportedEncodingException;

    /**
     * 微信小程序退出
     * @param paraMap
     * @return
     */
    ResponseResult weixinOut(Map<String, String> paraMap);

    /**
     * 注销账号
     * @param paraMap
     * @return
     */
    ResponseResult userLogoff(Map<String, String> paraMap);
}
